#include "or.hpp"

void		Or::solve()
{
  if (this->_state == UNDEFINED)
    {
      unsigned int				nb_entries = 0;
      AObject* elem;

      for (unsigned int i; i < this->_cond.size(); ++i)
	{
	  ++nb_entries;
	  elem = this->_cond.front();
	  this->_cond.pop();
	  elem->solve();
	  if (elem->getState() == TRUE)
	    {
	      this->_state = TRUE;
	      this->_cond.push(elem);
	      return ;
	    }
	  this->_cond.push(elem);
	}
      if (nb_entries != 0)
	this->_state = FALSE;
      else
	this->_state = UNDEFINED;
    }
}
